import React from 'react'
import { connect } from 'react-redux'
import { Button } from 'antd-mobile'
import { add, remove, addAsync } from './index.redux'

@connect(
    state => {
        return {num: state.counter}
    },
    {add, remove, addAsync}
)
class App extends React.Component{
    render(){
        //const { store } = this.props
        //const current = store.getState()
        const { num, add, remove, addAsync } = this.props
        return (
            <>
                <h1>当前有{num}把机关枪</h1>
                <button onClick={add}>增加</button>
                <button onClick={remove}>减少</button>
                <button onClick={addAsync}>异步增加</button>
                <Button type="primary">点击</Button>
            </>
        )
    }
}
//const mapStateToProp = state => {
//    return {
//        num: state
//    }
//}
export default App